Migrating DMA mappings from a source I/O adapter of a computing system to a destination I/O adapter of the computing system

ABSTRACT

Migrating DMA mappings from a source I/O adapter of a computing system to a destination I/O adapter of the computing system, includes: collecting, by a hypervisor of the computing system, DMA mapping information, where the hypervisor supports operation of a logical partition executing on the computing system and the logical partition is configured for DMA operations with the source I/O adapter utilizing the DMA mapping information; configuring, by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing, by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring the source I/O adapter from the logical partition; and enabling the logical partition and destination I/O adapter to recover from the error state.

BACKGROUND

Field of the Invention

The field of the invention is data processing, or, more specifically, methods, apparatus, and products for migrating DMA mappings.

Description of Related Art

A logical partition may be configured to utilize a physical, rather than virtual, I/O adapter. Such a configuration may rely on direct memory access operations between the I/O adapter. In current server-class systems there are large I/O fabrics incorporating many layers of bridge chips, switches, and I/O devices. The I/O devices themselves may be further virtualized in technologies such as SR-IOV. DMA requests generated by an I/O device must properly access only the appropriate memory for the owning logical partition (LPAR) for that I/O device.

The mapping of DMA addresses to LPAR memory involves an I/O translation table and associated hardware, often called an I/O Memory Management Unit (10 MMU) with the particular mappings of physical memory to PCI DMA addresses known as Translation Control Entries (TCEs). Setting up the TCE tables involves both hardware configuration and software configuration across many layers of the system including the hypervisor and the logical partition. The logical partition calls to the hypervisor to map LPAR memory pages to a DMA address, and can then inform the I/O adapter of the DMA address or addresses that the I/O adapter can use for operation. Any changes to these relationships require the updated configuration mappings to be communicated across all parties. This limits both configuration flexibility and the ability to reconfigure due, for example, to hardware failure or resource movement.

SUMMARY

Methods, apparatus, and products for migrating direct memory access (‘DMA’) mappings from a source input/output (‘I/O’) adapter of a computing system to a destination I/O adapter of the computing system are disclosed in this specification. Such migration may be carried out by: collecting, by a hypervisor of the source computing system, DMA mapping information, wherein the hypervisor supports operation of a logical partition executing on the computing system and the logical partition is configured for DMA operations with the source I/O adapter utilizing the DMA mapping information; configuring, by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing, by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring the source I/O adapter from the logical partition; and enabling the logical partition and destination I/O adapter to recover from the error state.

The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular descriptions of exemplary embodiments of the invention as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts of exemplary embodiments of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 sets forth an example system configured for migrating DMA mappings according to embodiments of the present invention.

FIG. 2 sets forth a functional block diagram of an example system configured for DMA mapping migration according to embodiments of the present invention.

FIG. 3 sets forth a set of example DMA mapping data structures in the form of several tables.

FIG. 4 sets forth a flow chart illustrating a further exemplary method for migrating DMA mappings from a source I/O adapter of a computing system to a destination I/O adapter of the computing system according to embodiments of the present invention.

FIG. 5 sets forth a flow chart illustrating a further exemplary method for DMA mapping migration according to embodiments of the present invention.

FIG. 6 sets forth a flow chart illustrating a further exemplary method for DMA mapping migration according to embodiments of the present invention.

FIG. 7 sets forth a flow chart illustrating a further exemplary method for DMA mapping migration according to embodiments of the present invention.

DETAILED DESCRIPTION

Embodiments of methods, apparatus, and computer program products for migrating DMA mappings from a source I/O adapter of a computing system to a destination I/O adapter of the computing system are described with reference to the accompanying drawings, beginning with FIG. 1. FIG. 1 sets forth an example system configured for migrating DMA mappings according to embodiments of the present invention. The example of FIG. 1 includes a data center (120). Such a data center may provide clients on host devices (195) with virtualization services for enabling various cloud related product offerings.

The example data center (120) of FIG. 1 includes automated computing machinery in the form of a computing system (102) configured for migrating DMA mappings from a source I/O adapter to a destination I/O adapter according to embodiments of the present invention. One example type of I/O adapter that may be configured for such DMA mapping migration is an SR-IOV adapter. Readers will recognize that such SR-IOV adapters are only an example of a type of I/O adapter and that many different types of I/O adapters may be configured for DMA mapping migration according to embodiments of the present invention. SR-IOV, Single-root I/O virtualization, is an extension to the PCI Express (PCIe) specification. SR-IOV allows a device, such as a network adapter, to separate access to its resources among various PCIe hardware functions. These functions consist of the following types: A PCIe Physical Function (PF) and a PCIe Virtual Function (VF). The PF advertises the device's SR-IOV capabilities. Each VF is associated with a device's PF. A VF shares one or more physical resources of the device, such as a memory and a network port, with the PF and other VFs on the device. From the perspective of a logical partition (116, 118) instantiated by a hypervisor (136), a VF appears as a fully functional physical PCIe adapter. In this way, a single physical adapter may be ‘shared’ amongst many logical partitions or multiple virtual functions may be instantiated for use by a single logical partition.

The computing system (102) includes at least one computer processor (156) or “CPU” as well as random access memory (168) or “RAM,” which is connected through a high speed memory bus (166) and bus adapter (158) to processor (156) and to other components of the computing system (102).

Stored in RAM (168) is a hypervisor (136) and a management console (138). The management console (138) may provide a user interface through which a user may direct the hypervisor (136) on instantiating and maintaining multiple logical partitions (116, 118), where each logical partition may provide virtualization services to one or more clients. The management console (138) may also administer the migration of the DMA mappings from a source I/O adapter to a destination I/O adapter in the same computing system (102).

Also stored in RAM (168) are two instances of an operating system (154), one for each logical partition (116, 118). Operating systems useful in computers configured for DMA mapping migration according to various embodiments include UNIX™, Linux™, Microsoft Windows™, AIX™, IBM's i™ operating system, and others as will occur to those of skill in the art. The operating systems (154), hypervisor (136), and management console (138) are shown in RAM (168), but many components of such software may typically be stored in non-volatile memory such as, for example, on a data storage (170) device or in firmware.

The computing system (102) may also include a storage device adapter (172) coupled through expansion bus (160) and bus adapter (158) to processor (156) and other components of the computing system (102). Storage device adapter (172) connects non-volatile data storage to the computing system (102) in the form of data storage (170). Storage device adapters useful in computers configured for DMA mapping migration according to various embodiments include Integrated Drive Electronics (“IDE”) adapters, Small Computing system Interface (“SCSI”) adapters, and others as will occur to those of skill in the art. Non-volatile computer memory also may be implemented as an optical disk drive, electrically erasable programmable read-only memory (so-called “EEPROM” or “Flash” memory), RAM drives, and so on, as will occur to those of skill in the art.

The example computing system (102) may also include one or more input/output (“I/O”) adapters (178). I/O adapters implement user-oriented input/output through, for example, software drivers and computer hardware for controlling output to display devices such as computer display screens, as well as user input from user input devices (181) such as keyboards and mice. The example computing system (104) may also include a video adapter (114), which may be an example of an I/O adapter specially designed for graphic output to a display device (180) such as a display screen or computer monitor. Video adapter (114) may be connected to processor (156) through a high speed video bus (164), bus adapter (158), and the front side bus (162), which may also be a high speed bus.

The example computing system (102) of FIG. 1 also includes several I/O adapters which may be implemented as SR-IOV adapters in the form of network adapters (124, 126, and 128). Any of the example network adapters from among network adapters (124, 126, and 128) may be configured to support SR-IOV and provide multiple virtual functions, where each of the virtual functions may be mapped to a respective logical partition (116, 118). In this way, each of the logical partitions may independently use a physical network adapter that is being shared among different logical partitions. Such network adapters may also be configured for data communications with other computers or devices (not shown) and for data communications with a data communications network (101). Such data communications may be carried out serially through RS-232 connections, through external buses such as a Universal Serial Bus (“USB”), through PCI and PCIe fabrics, through data communications networks such as IP data communications networks, and in other ways as will occur to those of skill in the art. Network adapters may implement the hardware level of data communications through which one computer sends data communications to another computer, directly or through a data communications network. Examples of communications adapters useful in computers configured for DMA mapping migration according to various embodiments include modems for wired dial-up communications, Ethernet (IEEE 802.3) adapters for wired data communications, and 802.11 adapters for wireless data communications.

The network adapters (124, 126, and 128) may further be configured for data communications with hosts (195) over a network (101) reachable through local area networks (LANs), such as LAN (100). The network adapters (124, 126, and 128) may further be configured for data communications with storage area networks (SANs), such as SAN (112), and for data communications with various storage devices, such as storage devices (106) and storage devices (108).

From time to time and for various reasons, it may be desirable or necessary to switch, or migrate, the I/O adapter in use by a logical partition to another I/O adapter. In prior art embodiments in which the logical partition is coupled to a source I/O adapter through a physical communication channel (rather than an entirely virtualized communications channel), the source I/O adapter must be deconfigured from the logical partition completely prior to migration. Once the source I/O adapter is deconfigured, another I/O adapter would be added to the logical partition as if a new adapter were added to the system. Further, in some embodiments, the logical partition and source I/O adapter have mapped a memory space (140) utilized by the LPAR and the source I/O adapter for DMA communications. In some embodiments, the logical partition may make a hypervisor call to map or unmap DMA memory for a particular I/O adapter. The hypervisor in the example of FIG. 1 maintains such DMA mappings (142) and the memory (140) that has been mapped for such a purpose. In prior art systems, such DMA mappings (142) created for a source I/O adapter must be recreated completely when a destination I/O adapter is added as a new adapter to the system.

By contrast, the computing system (102) of FIG. 1 may be configured for DMA mapping migration from a source I/O adapter to a destination I/O adapter of the computing system. The hypervisor (136) may carry out the DMA mapping migration by: collecting DMA mapping information (142); configuring the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing the source and destination I/O adapter in an error state; deconfiguring the source I/O adapter from the logical partition; and enabling the logical partition and destination I/O adapter to recover from the error state. Here, the DMA mappings, need not be recreated from scratch when the destination I/O adapter recovers from the error state and establishes communications with the logical partition. Further, the destination I/O adapter need not be added to the system as if the destination I/O adapter were an entirely new adapter. Generally, from the perspective of both the destination I/O adapter and logical partition, the two were always coupled, encountered an error and re-established communications.

Examples of such an I/O adapter may be the network adapters (124, 126, and 128) of FIG. 1. The network adapters (124, 126, and 128) are for purposes of illustration, not for limitation. Similarly, data centers according to various embodiments may include additional servers, routers, other devices, and peer-to-peer architectures, not shown in the figures, as will occur to those of skill in the art. Networks in such data processing systems may support many data communications protocols, including for example TCP (Transmission Control Protocol), IP (Internet Protocol), HTTP (HyperText Transfer Protocol), WAP (Wireless Access Protocol), HDTP (Handheld Device Transport Protocol), and others as will occur to those of skill in the art. Various embodiments may be implemented on a variety of hardware platforms in addition to those illustrated.

The arrangement of servers and other devices making up the exemplary system illustrated in FIG. 1 are for explanation, not for limitation. Data processing systems useful according to various embodiments of the present invention may include additional servers, routers, other devices, and peer-to-peer architectures, not shown in FIG. 1, as will occur to those of skill in the art. Networks in such data processing systems may support many data communications protocols, including for example TCP (Transmission Control Protocol), IP (Internet Protocol), HTTP (HyperText Transfer Protocol), WAP (Wireless Access Protocol), HDTP (Handheld Device Transport Protocol), and others as will occur to those of skill in the art. Various embodiments of the present invention may be implemented on a variety of hardware platforms in addition to those illustrated in FIG. 1.

For further explanation, FIG. 2 sets forth a functional block diagram of an example system configured for DMA mapping migration according to embodiments of the present invention. The example system of FIG. 2 includes a management console (226). A management console may be implemented as a module of automated computing machinery comprising computer hardware and software. The management console (226) may be coupled to a computing system (202) through various networking devices, protocols, and fabrics. The management console may provide a user interface through which a user may direct a hypervisor (206) on instantiating and maintaining logical partitions, where each logical partition may provide virtualization services to one or more clients. The management console (226) may also direct hypervisors to migrate DMA mappings from one I/O adapter to another within the computing system.

In the example of FIG. 2, the computing system (202) is a computing system similar that depicted in the example of FIG. 1. The example computing system (202) of FIG. 2 include a hypervisor (206) that supports execution of at least one logical partition (204). The logical partition is coupled to a source I/O adapter (212) for I/O operations.

The term ‘source’ is used here solely to denote that the I/O adapter is the origin of a migration of DMA mappings. Likewise, the term ‘destination’ is utilized merely to indicate that the destination I/O adapter (224) is a target of a migration of DMA mappings. The logical partition (204) has mapped, through one or more hypervisor calls, logical partition memory as a DMA space (210) for use in DMA operations with the source I/O adapter (212). Upon each mapping, unmapping, and modification of a mapped memory for use in DMA operations, the hypervisor updates the mapping tables (208). Although explained in greater detail below with respect to FIG. 3, when the logical partition maps a memory space, say four pages at 4 KB each, the hypervisor provides the logical partition with a memory address to use in DMA operations targeting the mapped memory space (210). From the logical partition's perspective, the addresses are real physical addresses. In reality, the addresses are logical addresses. Such logical addresses are stored, in general, in one or more tables and each logical address is mapped to a real memory address. Such tables are accessible by an I/O memory management unit (IOMMU), which is not shown for purposes of simplicity, when used in DMA operations between the source I/O adapter (212) and the logical partition (204).

For further explanation, consider an example DMA operation between the source I/O adapter (212) and the logical partition (204). When the source I/O adapter (212) attempts to store data in the DMA space (210) mapped for such a purpose, the source I/O adapter (212) issues a PUT command on an I/O fabric coupling the LPAR, the IOMMU, and the source I/O adapter. The PUT command includes, among other attributes, the logical address of the DMA memory space (210). The IOMMU snoops the DMA PUT command from the I/O fabric, translates the logical address to a real address, and moves the subject data of the DMA PUT command from the data's current location into the physical memory addressed by the real address. The IOMMU may set a flag in a DMA queue which indicates, to the logical partition, that data is ready to be retrieved from the DMA space.

This is just one example, with minimal detail regarding translation. The example highlights, however, that the address provided to the logical partition in response to mapping a memory space for DMA operations, is not a real address, even though the logical partition and the source I/O adapter believe the address to be real.

In the example of FIG. 2, the management console (226) may initiate a switch, or migration, between the logical partition (204) utilizing the source I/O adapter (212) and the logical partition utilizing the destination I/O adapter (224). In other embodiments, such a migration may be initiated as part of a failover or load balancing operation that occurs on demand and without the management console's instruction. In prior art systems, in order to switch the logical partition from utilizing the source I/O adapter to the destination I/O adapter, the source I/O adapter must be deconfigured entirely from the system, essentially removing all DMA mappings entirely, prior to configuring the destination I/O adapter in the device tree. Upon such an addition, the logical partition would need to recreate all the previous DMA mappings through hypervisor calls.

By contrast, the system of FIG. 2 is configured for DMA mapping migration according to embodiments of the present invention. At the behest of the management console (226) or dynamically, in response to a failover, the hypervisor (206) may prepare for DMA mapping migration as part of the switch from the logical partition utilizing the source I/O adapter to the destination I/O adapter. The hypervisor (206), among other operations to prepare for the migration of the DMA mapping, may collect DMA mapping information, such as the information stored within the mapping tables (208). In embodiments in which the I/O adapter is implemented as a PCI express (PCIe) adapter, the DMA mapping information may include one or more data structures specifying: a size of a range allocated to the PCIe device for DMA operations; data from a PCIe configuration space including a requester identifier of the PCIe adapter; and a logical addresses to physical memory address mappings, where each mapping represents a memory page and each mapping includes access permissions for the memory page.

The hypervisor (206) may then configure the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor and place the source and destination I/O adapter into an error state. Such an error state may include the ‘EEH’ (enhanced error handling) error state which is an extension to the PCI standard specification and enabled in systems running IBM's Power™ Processors. The hypervisor may then deconfigure the source I/O adapter from the logical partition by removing the source I/O adapter from the logical partition's device tree. Once, completely deconfigured the hypervisor may enable the logical partition and destination I/O adapter to recover from the error state. Once recovered, the logical partition and destination I/O adapter may utilize, for DMA operations, the same logical addresses originally provided to the logical partition when mapping DMA space for use with the source I/O adapter. The hypervisor, upon completion of the switch to the destination I/O adapter, may notify the management console or user of such completion.

As mentioned above, in some embodiments, specifically in embodiments in which the I/O adapter is implemented as a PCIe adapter or SR-IOV adapter, the DMA mapping information collected by the hypervisor and utilized to update mapping information on the destination I/O adapter may be implemented as one or more data structures specifying: a size of a range allocated to the PCIe device for DMA operations; data from a PCIe configuration space including a requester identifier of the PCIe adapter; and a logical addresses to physical memory address mappings, where each mapping represents a memory page and each mapping includes access permissions for the memory page. For further explanation, therefore, FIG. 3 sets forth a set of example DMA mapping data structures in the form of several tables.

The example of FIG. 3 includes an RID translation table (308). An RID as the term is used here refers to a requester identifier. In PCI-express architectures, each PCI device under a root complex is uniquely identified by an RID. The RID may be a triplet of a bus number, device number, and function number. Such attributes may be stored in a configuration space of the PCIe adapter. The RID may be used to control access to memory or other resources in the system. That is, a PCI host bridge or IOMMU may confirm, for each, access to a memory location by an I/O adapter that the I/O adapter is allowed access to such memory location based in part on the RID of the I/O adapter.

In the example of FIG. 3, a DMA command (302) issued on the I/O bus includes an RID and a DMA address (314), among other attributes. The DMA address is a logical address as established by the hypervisor upon mapping a DMA space. As mentioned above, however, from the perspective of the logical partition and the I/O adapter, the DMA address is a real memory address.

The RID (306) included in the example command is used as an index (304) into the RID translation table (308). The RID translation table includes a number of entries, with each entry including a partitionable endpoint number (312). A partitionable endpoint or “PE” as the term is used in this specification refers to a logical identifier of any component or subcomponent of an I/O subsystem that can be allocated to a logical partition independently of any other component or subcomponent of the I/O subsystem. For example, some PEs may comprise a plurality of I/O adapters and I/O fabric components that function together and, thus, are allocated as a unit to a single logical partition. Another PE, however, may comprise a portion of a single I/O adapter, for example, a separately configurable and separately assignable port of a multi-port I/O adapter. In general, a PE is identified by its function rather than by its structure. Use of such PE's enables isolation of I/O resources between logical partitions.

The partitionable endpoint number identified from the table through the index (304) of the RID (306), is then used along with the DMA address (314) from the DMA command (302) as index (316) into a TCE validation table (‘TVT’) (310). In some embodiments, there is one TVT (310) for each partitionable endpoint. TCE or “translation control entry” refers to an entry in a TCE table discussed below in greater detail. Each entry in the TCE validation table (310) of FIG. 3 includes a DMA address range and a pointer to an entry in the TCE table (318). There may exist multiple different DMA address ranges in the TCE validation table (310) for the particular PE. Consider for example that a logical partition has mapped three distinct DMA memory ranges for use in DMA operations between a single PE. In such an example, the TCE validation table for that PE will include three separate entries. The DMA address (314) of the DMA command is then used to identify the correct entry by locating the entry that includes the DMA address range that encompasses the DMA address (314).

The pointer of the entry that matches the index (316) identifies an entry in the TCE table (318) that represents the first memory page at the beginning of the DMA address range. Each entry in the TCE table (318) may represent a particular size, such a 4 KB page of memory. As such, the DMA address (314) may be used as an offset relative to the memory address represented by the entry pointed to by the pointer of the TCE validation table (310). Each entry includes a real memory address and access permissions such as read, write, or no permissions. The output of the TCE table is a real address (320) which may be used to perform the DMA command (302) and the access permissions (322) associated with the RID (306).

Readers of skill in the art will recognize that the tables set forth above are examples only and not a limitation. In some embodiments, fewer or more tables may be implemented to store DMA mappings between a logical partition and an I/O device. Further, the entries in each table may have fewer or greater attributes than those depicted here.

To collect DMA mapping information for later DMA mapping migration in a system that includes tables such as those set forth in the example, the hypervisor of the system collects all DMA addresses ranges for the partitionable endpoint that matches the RID of the I/O adapter, the real memory addresses that map to the DMA addresses ranges, and permissions. The hypervisor, in configuring the destination I/O adapter with DMA mappings, may establish or modify similar tables, associate the RID of destination I/O adapter with a partitionable endpoint that indexes into entries of the TCE validation table having the same DMA address ranges (logical addresses) that were present in the source computing system, and create entries in the TCE table for the same number of memory pages that existed on the source computing system along with the associated permissions for each such page.

For further explanation, FIG. 4 sets forth a flow chart illustrating a further exemplary method for migrating DMA mappings from a source I/O adapter of a computing system to a destination I/O adapter of the computing system according to embodiments of the present invention. The computing system includes a hypervisor that supports operation of a logical partition executing on the computing system and the logical partition is configured for DMA operations with the source I/O adapter utilizing DMA mapping information.

The method of FIG. 4 includes collecting (402), by the hypervisor of the computing system, DMA mapping information for the source I/O adapter. The DMA mapping information may include logical addresses, the total amount of address space for each mapped DMA memory region, and any permissions associated with those DMA memory regions. Collecting (402) such information may be carried out by gathering various entries in mapping tables designated for such purpose.

The method of FIG. 4 also includes configuring (404), by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor. Configuring (404) the destination I/O adapter with such DMA mappings may include creating or modifying existing mapping tables to reflect that the destination I/O adapter is taking the place of the source I/O adapter. Such modification may include establishing a PE number for the destination I/O adapter, associating the PE number of the destination I/O adapter with the same DMA address ranges (logical addresses) from the source I/O adapter mapping information, and setting the same permissions for real addresses (which need not be the same as the originally mapped real addresses) that map to the DMA address ranges.

The method of FIG. 4 also includes placing (406), by the hypervisor, the source and destination I/O adapter in an error state. Placing (406) the I/O adapters in an error state may be carried out by forcing the I/O adapters into an ‘EEH’ error state which is an extension to the PCI standard specification and enabled in systems running IBM's Power™ Processors.

The method of FIG. 4 also includes deconfiguring (408) the source I/O adapter from the logical partition. Deconfiguring (408) the source I/O adapter from the logical partition may be carried out by removing the source I/O adapter from the logical partition's device tree through one or more calls to an I/O adapter driver executing in the logical partition.

The method of FIG. 4 also includes enabling (410) the logical partition and destination I/O adapter to recover from the error state. Enabling (410) the logical partition and destination I/O adapter to recover from the error state may be carried out in various ways including injecting a command on the I/O adapter bus designated for such a purpose, setting or removing a flag at a particular location in I/O adapter memory and logical partition memory designated for such purpose, or otherwise informing an I/O adapter driver of the logical partition that recovery can proceed.

For further explanation, FIG. 5 sets forth a flow chart illustrating a further exemplary method for DMA mapping migration according to embodiments of the present invention. The method of FIG. 5 is similar to the method of FIG. 4 in that the method of FIG. 5 is carried out for a computing system that includes a source I/O adapter, a destination I/O adapter, and a hypervisor that supports operation of a logical partition executing on the computing system, where the logical partition and source I/O adapter are coupled for DMA operations. The method of FIG. 5 is also similar to the method of FIG. 4 in that the method of FIG. 5 includes: collecting (402), by a hypervisor of the computing system, DMA mapping information; configuring (404), by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing (406), by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring (408) the source I/O adapter from the logical partition; and enabling (410) the logical partition and destination I/O adapter to recover from the error state.

The method of FIG. 5 differs from the method of FIG. 4, however, in that the method of FIG. 5 includes updating (502), by the hypervisor, mappings of hypervisor calls from the logical partition to modify DMA address mappings to be directed to the destination I/O adapter. As mentioned above, to map or unmap DMA address space for the I/O adapter, the logical partition makes calls to the hypervisor. Such calls made with respect to the source I/O adapter may be made by use of the RID of the source I/O adapter. That is, a call to map or unmap memory space may be formulated by the logical partition with the RID of the source I/O adapter. Because the source I/O adapter will no longer be the target of such mapping calls, the RID of the source I/O adapter will be ineffective without additional care. To that end, the hypervisor may create or manage a table that includes an entry that associates the source I/O adapter's RID with the destination I/O adapter's RID. When a call is received by the hypervisor to map or unmap a memory region for DMA operations and that call includes the source I/O adapter's RID, the destination hypervisor may translate the source I/O adapter's RID to the destination adapter's RID utilizing the table.

For further explanation, FIG. 6 sets forth a flow chart illustrating a further exemplary method for DMA mapping migration according to embodiments of the present invention. The method of FIG. 6 is similar to the method of FIG. 4 in that the method of FIG. 6 is carried out for a computing system that includes a source I/O adapter, a destination I/O adapter, and a hypervisor that supports operation of a logical partition executing on the computing system, where the logical partition and source I/O adapter are coupled for DMA operations. The method of FIG. 6 is also similar to the method of FIG. 4 in that the method of FIG. 6 includes: collecting (402), by a hypervisor of the computing system, DMA mapping information; configuring (404), by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing (406), by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring (408) the source I/O adapter from the logical partition; and enabling (410) the logical partition and destination I/O adapter to recover from the error state.

The method of FIG. 6 differs from the method of FIG. 4, however, in that the method of FIG. 6 also includes detecting (602), by the logical partition, the error state and preventing (604), by the hypervisor, the logical partition from recovering from the error state until the source I/O adapter is deconfigured from the logical partition. The logical partition may detect the error state in a variety of ways including, for example, upon realizing the loss of communications with the source I/O adapter, or upon receiving in the I/O data communications an indication of the error. Under normal circumstances, both the source I/O adapter and the logical partition would, if able, begin recovery procedures immediately. By contrast, in the example of FIG. 6, the hypervisor prevents (604) the logical partition from recovering from the error state. The hypervisor may prevent the logical partition from recovering from the error state by injecting, into error data on the I/O bus, an indication that a higher level event needs to be recovered prior to recovering the I/O adapter communication channel. Such an indication informs the I/O adapter driver of logical partition that recovery cannot yet proceed. Upon deconfiguring the source I/O adapter from the system and fully configuring the destination I/O adapter, the hypervisor may inject data into onto the I/O bus that indicates that recovery can proceed or otherwise provide the driver of the logical partition a notification that that the previous, higher level event, has been addressed.

For further explanation, FIG. 7 sets forth a flow chart illustrating a further exemplary method for DMA mapping migration according to embodiments of the present invention. The method of FIG. 7 is similar to the method of FIG. 4 in that the method of FIG. 7 is carried out for a computing system that includes a source I/O adapter, a destination I/O adapter, and a hypervisor that supports operation of a logical partition executing on the computing system, where the logical partition and source I/O adapter are coupled for DMA operations. The method of FIG. 7 is also similar to the method of FIG. 4 in that the method of FIG. 7 includes: collecting (402), by a hypervisor of the computing system, DMA mapping information; configuring (404), by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing (406), by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring (408) the source I/O adapter from the logical partition; and enabling (410) the logical partition and destination I/O adapter to recover from the error state.

The method of FIG. 7 differs from the method of FIG. 4, however, in that the method of FIG. 7 also includes mirroring (702) modifications to the DMA mapping information of the source I/O adapter to the DMA mappings of the destination I/O adapter prior to recovering (410) from the error state and during the configuration (414) the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor. An appreciable amount of time may lapse between the initiation of the migration from the source I/O adapter to the destination I/O adapter. To reduce downtime of the logical partition, the logical partition may be configured to continue to make modifications to the DMA mappings of the source I/O adapter, even after the migration has begun, but before the migration has completed. Any such modifications to DMA mappings on the source computing system are mirrored on the destination I/O adapter DMA mappings until the logical partition is enabled to recover from the error state.

The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.

Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.

These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.

The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.

The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.

It will be understood from the foregoing description that modifications and changes may be made in various embodiments of the present invention without departing from its true spirit. The descriptions in this specification are for purposes of illustration only and are not to be construed in a limiting sense. The scope of the present invention is limited only by the language of the following claims. 

What is claimed is:
 1. A method of migrating direct memory access (‘DMA’) mappings from a source input/output (‘I/O’) adapter of a computing system to a destination I/O adapter of the computing system, the method comprising: collecting, by a hypervisor of the computing system, DMA mapping information, wherein the hypervisor supports operation of a logical partition executing on the computing system and the logical partition is configured for DMA operations with the source I/O adapter utilizing the DMA mapping information; configuring, by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing, by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring the source I/O adapter from the logical partition; and enabling the logical partition and destination I/O adapter to recover from the error state.
 2. The method of claim 1 further comprising: updating, by the hypervisor, mappings of hypervisor calls from the logical partition to modify DMA address mappings to be directed to the destination I/O adapter.
 3. The method of claim 1 wherein: the source I/O adapter is a PCI express adapter; the DMA mapping information further comprises one or more data structures specifying: a size of a range allocated to the PCIe device for DMA operations; data from a PCIe configuration space including a requester identifier of the PCIe adapter; and logical addresses to physical memory address mappings, wherein each mapping represents a memory page and each mapping includes access permissions for the memory page.
 4. The method of claim 3 wherein the PCIe adapter further comprises a single-root I/O virtualization adapter.
 5. The method of claim 1 further comprising, prior to recovering from the error state and during the configuration the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor, mirroring modifications to the DMA mapping information of the source I/O adapter to the DMA mappings of the destination I/O adapter.
 6. The method of claim 1 wherein a management console is coupled to the computing system and the method further comprises: administering the migration of the DMA mappings from the source I/O adapter to the destination I/O adapter.
 7. The method of claim 1 further comprising: detecting, by the logical partition, the error state; and preventing, by the hypervisor, the logical partition from recovering from the error state until the source I/O adapter is deconfigured from the logical partition.
 8. An apparatus for migrating direct memory access (‘DMA’) mappings from a source input/output (‘I/O’) adapter of a computing system to a destination I/O adapter of the computing system, the apparatus comprising a computer processor, a computer memory operatively coupled to the computer processor, the computer memory having disposed within it computer program instructions that, when executed by the computer processor, cause the apparatus to carry out the steps of: collecting, by a hypervisor of the computing system, DMA mapping information, wherein the hypervisor supports operation of a logical partition executing on the computing system and the logical partition is configured for DMA operations with the source I/O adapter utilizing the DMA mapping information; configuring, by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing, by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring the source I/O adapter from the logical partition; and enabling the logical partition and destination I/O adapter to recover from the error state.
 9. The apparatus of claim 8 further comprising computer program instructions that, when executed by the computer processor, cause the apparatus to carry out the step of: updating, by the hypervisor, mappings of hypervisor calls from the logical partition to modify DMA address mappings to be directed to the destination I/O adapter.
 10. The apparatus of claim 8 wherein: the source I/O adapter is a PCI express adapter; the DMA mapping information further comprises one or more data structures specifying: a size of a range allocated to the PCIe device for DMA operations; data from a PCIe configuration space including a requester identifier of the PCIe adapter; and logical addresses to physical memory address mappings, wherein each mapping represents a memory page and each mapping includes access permissions for the memory page.
 11. The apparatus of claim 10 wherein the PCIe adapter further comprises a single-root I/O virtualization adapter.
 12. The apparatus of claim 8 further comprising computer program instructions that, when executed by the computer processor, cause the apparatus to carry out the step of: prior to recovering from the error state and during the configuration the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor, mirroring modifications to the DMA mapping information of the source I/O adapter to the DMA mappings of the destination I/O adapter.
 13. The apparatus of claim 8 wherein a management console is coupled to the computing system and the apparatus further comprises computer program instructions that, when executed by the computer processor, cause the apparatus to carry out the step of: administering the migration of the DMA mappings from the source I/O adapter to the destination I/O adapter.
 14. A computer program product for migrating direct memory access (‘DMA’) mappings from a source input/output (‘I/O’) adapter of a computing system to a destination I/O adapter of the computing system, the computer program product disposed upon a computer readable storage medium, the computer program product comprising computer program instructions that, when executed, cause a computer to carry out the steps of: collecting, by a hypervisor of the computing system, DMA mapping information, wherein the hypervisor supports operation of a logical partition executing on the computing system and the logical partition is configured for DMA operations with the source I/O adapter utilizing the DMA mapping information; configuring, by the hypervisor, the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor; placing, by the hypervisor, the source and destination I/O adapter in an error state; deconfiguring the source I/O adapter from the logical partition; and enabling the logical partition and destination I/O adapter to recover from the error state.
 15. The computer program product of claim 14 further comprising computer program instructions that, when executed, cause the computer to carry out the step of: updating, by the hypervisor, mappings of hypervisor calls from the logical partition to modify DMA address mappings to be directed to the destination I/O adapter.
 16. The computer program product of claim 14 wherein: the source I/O adapter is a PCI express adapter; the DMA mapping information further comprises one or more data structures specifying: a size of a range allocated to the PCIe device for DMA operations; data from a PCIe configuration space including a requester identifier of the PCIe adapter; and logical addresses to physical memory address mappings, wherein each mapping represents a memory page and each mapping includes access permissions for the memory page.
 17. The computer program product of claim 16 wherein the PCIe adapter further comprises a single-root I/O virtualization adapter.
 18. The computer program product of claim 14 further comprising computer program instructions that, when executed, cause the computer to carry out the step of: prior to recovering from the error state and during the configuration the destination I/O adapter with DMA mappings based on the DMA mapping information collected by the hypervisor, mirroring modifications to the DMA mapping information of the source I/O adapter to the DMA mappings of the destination I/O adapter.
 19. The computer program product of claim 14 wherein a management console is coupled to the computing system and the apparatus further computer program instructions that, when executed, cause the computer to carry out the step of: administering the migration of the DMA mappings from the source I/O adapter to the destination I/O adapter.
 20. The computer program product of claim 14 further comprising computer program instructions that, when executed, cause the computer to carry out the step of: detecting, by the logical partition, the error state; and preventing, by the hypervisor, the logical partition from recovering from the error state until the source I/O adapter is deconfigured from the logical partition. 